{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Markdown 过期\n",
    "## 学习构成\n",
    "1 语法部分\n",
    "2 项目部分：简单黑客\n",
    "\n",
    "项目：举报！我的同桌又玩游戏了！"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Markdown 过期\n",
    "## 语法\n",
    "gui - 图形化用户交互界面\n",
    "auto - 自动\n",
    "py - python的缩写\n",
    "range - 范围"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "#课上内容\n",
    "#未优化\n",
    "\n",
    "#导入库\n",
    "import pyautogui as gui \n",
    "import time \n",
    "\n",
    "#截图程序\n",
    "for i in range(10): #循环\n",
    "    time.sleep(1) #延时\n",
    "    gui.screenshot(time.strftime(\"%H%M%S.jpg\")) #文件保存"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "#课上内容\n",
    "#优化失败\n",
    "\n",
    "#导入库 \n",
    "import pyautogui as gui \n",
    "import time \n",
    "\n",
    "#参数设置\n",
    "delay_time = 1 #delaytime must bigger then 1.0\n",
    "range_num = 10\n",
    "file_name = time.strftime(\"%H%M%S.jpg\") #名字设置\n",
    "\n",
    "#截图程序\n",
    "for i in range(range_num): #循环\n",
    "    time.sleep(delay_time) #延时\n",
    "    gui.screenshot(file_name) #文件保存"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Debug]\n",
      "alert_title:title\n",
      "alert_text:text\n",
      "ok_title:1\n",
      "ok_text:2\n",
      "cancel_title:3\n",
      "cancel_text:4\n",
      "hotkey_mode:0\n",
      "debug_mode:1\n",
      "output:Cancel\n"
     ]
    }
   ],
   "source": [
    "#自己写的pyautogui测试\n",
    "\n",
    "#导入库\n",
    "import pyautogui as gui \n",
    "import time\n",
    "\n",
    "#设置变量\n",
    "alert_title = \"title\"\n",
    "alert_text = \"text\"\n",
    "ok_title = \"1\"\n",
    "ok_text = \"2\" \n",
    "cancel_title = \"3\"\n",
    "cancel_text = \"4\"\n",
    "hotkey_mode = 0\n",
    "debug_mode = 1\n",
    "\n",
    "#警告窗口程序\n",
    "output_log = gui.confirm(title=alert_title,text=alert_text,buttons=('OK', 'Cancel')) #警告\n",
    "if output_log == \"OK\":\n",
    "    gui.alert(title=ok_title,text=ok_text)\n",
    "    if hotkey_mode == 1:\n",
    "        gui.hotkey(\"ctrl\",\"w\")\n",
    "if output_log == \"Cancel\":\n",
    "    gui.alert(title=cancel_title,text=cancel_text)\n",
    "    \n",
    "#数据输出（debug)\n",
    "if debug_mode == 1:\n",
    "    print(\"[Debug]\")\n",
    "    print(\"alert_title:\"+alert_title)\n",
    "    print(\"alert_text:\"+alert_text)\n",
    "    print(\"ok_title:\"+ok_title)\n",
    "    print(\"ok_text:\"+ok_text)\n",
    "    print(\"cancel_title:\"+cancel_title)\n",
    "    print(\"cancel_text:\"+cancel_text)\n",
    "    print(\"hotkey_mode:\"+str(hotkey_mode))\n",
    "    print(\"debug_mode:\"+str(debug_mode))\n",
    "    print(\"output:\"+output_log)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "#导入库\n",
    "import pyautogui as gui\n",
    "\n",
    "#窗口程序\n",
    "ol1 = gui.confirm(title=\"请选择\",text=\"是否启动Minecraft\",buttons=('OK', 'Cancel'))\n",
    "if ol1 == \"OK\":\n",
    "    ol2 = gui.confirm(title=\"选择用户名\",text=\"确定 -> CX_lingyun\\n取消 -> XiaMeng\",buttons=('OK', 'Cancel'))\n",
    "    if ol2 == \"OK\":\n",
    "        !start ttl119.ly.bat\n",
    "    if ol2 == \"Cancel\":\n",
    "        !start ttl119.xiameng.bat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  },
  "vscode": {
   "interpreter": {
    "hash": "c3bd44260b24975a52c0b6e3efc83d7e83b0017dee8c9f9cd5ef0c9b3940f46d"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
